from django.shortcuts import render

# Create your views here.
# viewsets通过serializer_class找到对应的serializers
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet, ViewSet

from data.models import Student
from data.serializers import StudentSerializer
from filter.ModelViewReturn import ModelViewReturn


class StudentViewSet(ViewSet):
    # queryset = Student.objects.all()
    # serializer_class = StudentSerializer
    # pagination_class = StandardResultsSetPagination

    @action(methods=['post'], url_path='list', url_name='student', detail=False)
    # @list_route(methods=('get',), permission_classes=(permissions.IsAuthenticated,))
    def test(self, request):
        return Response(111)


    @action(methods=['post'], url_path='list1', url_name='student', detail=False)
    def test1(self, request,pk=None):
        return Response(222)